import { _decorator, Component, EventTouch, Input, input, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('moveCamera')
export class moveCamera extends Component {
    @property({ type: Number }) speed: number = 0.1;
    start() {
        input.on(Input.EventType.TOUCH_MOVE, this.moveCamera, this);
    }

    update(deltaTime: number) {

    }

    moveCamera(event: EventTouch) {
        this.node.setPosition(this.node.position.x + event.getDelta().x * -this.speed, this.node.position.y - event.getDelta().y * this.speed)
    }
}


